package com.rq.app_base;


import com.base.rq.LOG;
import com.rq.app_base.android.AndroidSystemAdapter;

/**
 * @author RQ
 * date    2021-07-09 13:55
 */
public class CtrProxy {

  static Class<? extends SystemAdapter> baseClazz = AndroidSystemAdapter.class;
  SystemAdapter mSystemAdapter;

  private static class SingletonHolder {
    public final static CtrProxy instance = new CtrProxy();
  }

  public static void setAdapter(Class<? extends SystemAdapter> clazz) {
    CtrProxy.baseClazz = clazz;
  }

  public static CtrProxy get() {
    return SingletonHolder.instance;
  }

  private CtrProxy() {
    try {
      this.mSystemAdapter = baseClazz.newInstance();
    } catch (Exception e) {
      LOG.e("CtrProxy", "CtrProxy.26:");
    }
  }

  public final int setData2View(int vId, Object data) {
    return mSystemAdapter.setData2View(mSystemAdapter.getView(vId), data);
  }

}
